const state = {
	token: false,
	userid: '',
	username: '',
	usersex: '',
	usercar: '',
	yeartotal: '', 
	monthtotal: ''
};
const mutations = {
	setId: function (state, id) {
		state.userid = id;
	},
	setName: function (state, name) {
		state.username = name;
	},
	setToken: function (state, flag) {
		state.token = flag;
	},
	setSex: function (state, sex) {
		state.usersex = sex;
	},
	setCar: function (state, car) {
		state.usercar = car;
	},
	setYearTotal: function (state, year) {
		state.yeartotal = year;
	},
	setMonthTotal: function (state, month) {
		state.monthtotal = month;
	},
	setUserMsg: function (state, msg) {
		state.username = msg.username || '';
		state.usercar = msg.usercar || '';
	}
}
const getters = {
	getId: function (state) {
		return state.userid;
	},
	getToken: function (state) {
		return state.token;
	},
	getUserName: function (state) {
		return state.username;
	}
}
const user = {
	state, mutations, getters
};
export default user;